﻿#pragma once

#include "StatusBar/EditorStatusItemViewModel.h"
#include "Framework/Tickable.h"
#include "EditorFPSStatusViewModel.m.h"

class REditorFPSStatusModel;

//显示FPS的状态项
RCLASS()
class REditorFPSStatusViewModel : public REditorStatusItemViewModel, public ITickable
{
    ROBJECT

public:
    virtual void BindModel(TSharedObjectPtr<REditorStatusItemModel> InModel) override;

    //不能实时更新帧率，实时更新会导致界面数字频繁变化，看不清楚
    //所以每隔一段时间更新一次
    CString GetFPS() const;

    virtual void Tick(float DeltaSeconds) override;
protected:
    TWeakObjectPtr<REditorFPSStatusModel> FPSModel;

protected:

    CString FPS=0;
    float PastTime=10; //初始值大于Interval，保证第一次更新，单位秒

};